package com.example.fitnessservice.module.dao.usermapper;

import com.example.fitnessservice.module.pojo.UserBodyData;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface BodyDataMapper {
    @Select("select * from user_bodydata where user_id = #{userId} order by submit_time asc limit 5")
    public List<UserBodyData> findBodyDataById(Integer userId);

    @Insert("insert into user_bodydata values (null, #{userId}, #{userAge}, #{userWeight}, #{userHeight}, #{userChest}, #{userGirth}, #{bmi}, #{submitTime})")
    public int addBodyData(UserBodyData userBodyData);

    @Select("select * from user_bodydata where user_id = #{userId} order by submit_time desc")
    List<UserBodyData> findBodyDataByPage(Integer userId);
}
